<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="maximum-scale=1.0, minimum-scale=1.0, user-scalable=0, initial-scale=1.0, width=device-width"/>
<meta name="format-detection" content="telephone=no, email=no, date=no, address=no">
<title>Hello APP</title>
<link rel="stylesheet" type="text/css" href="../../css/aui-flex.css" />
<link rel="stylesheet" type="text/css" href="../../css/aui.css" />
<link rel="stylesheet" type="text/css" href="../../css/common.css" />
<style>
.aui-content{
	padding: 1rem;
}
.tit{
	font-size: 1.2rem;
	font-weight: bold;
}
.block{
	width: 0.3rem;
	height: 0.3rem;
	display: inline-block;
	background-color: #363335;
	margin-right: 0.2rem;
}
.pt-40{
	padding-top: 2rem;
}
.info-list{
	font-size: 0.7rem;
}
dl.comFlexItem dt {
		width: 5rem;
}
dl.comFlexItem{
	padding-top: 0.25rem;
}
select,
input.textInput {
		font-size: 0.7rem;
		height: 2rem;
}
.comFlexItem select,
.comFlexItem input.textInput {
		text-align: right;
		padding: 0 0.5rem;
}
.bom-tit{
	padding-top: 1.1rem;
	font-size: 0.6rem;
	line-height: 1rem;
	color: #999999;
}
.comBox{
	position: fixed;
	bottom: 1rem;
	border-radius: 5rem;
	padding: 0 1rem;
	width: 100%;
}
.comBtmBtn{
	height: 2.5rem;
	line-height: 2.5rem;
	border-radius: 5rem;
}
.cardBox{
	margin-top: 1rem;
	height: 3.2rem;
	border-radius: 4px;
	background-color: rgba(0, 170, 238, 1);
	padding: 0 0.65rem;
}
.cardBox p{
	color: #fff;
	font-size:0.2rem;
}
.cardBox .aui-iconfont{
	font-size: 0.5rem;
}
.opacity{
	opacity: 0.7
}
#name{
	font-size: 1em;
}
#account{
	font-size: 1em;
}
</style>
</head>
<body>
	<div class="aui-content">
		<div class="tit color-000">提现</div>
		<div class="cardBox comFlexItem" tapmode onclick="openWin('ti_cash_win')">
			<div><img src="../../image/mine/1.png" style="height:1.5rem" alt=""></div>
			<div class="flex-auto aui-padded-l-15">
				<p id="name"></p>
				<p id="account"></p>
			</div>
			<div><i class="aui-iconfont aui-icon-right color-fff"></i></div>
		</div>
		<div class="info-list">
			<dl class="comFlexItem aui-border-b">
				<dt>提现金额</dt>
				<dd class="flex-auto">
					<input type="text" class="textInput" id="amount" name="" value="余额0.00元" readonly>
				</dd>
			</dl>
		</div>
		<div class="bom-tit">
			1、单笔金额低于<span class="xiane"></span>元，无法提现；金额大于等于<span class="xiane"></span>元，可以提现，且提现收取<span id="service"></span>%手续费；<br/>
			2、提现到账时间为1-2个工作日，节假日顺延，请耐心等待；<br/>
			3、每月<span id="time1"></span>号、<span id="time2"></span>号为提现日，其他时间无法提现；<br/>
			4、更多提现问题，可查阅<span tapmode onclick="openHelp()">《提现帮助》</span>。
		</div>

	</div>
	<div class="comBox bg-white">
		<div class="comBtmBtn opacity" tapmode onclick="next()">申请提现</div>
	</div>
</body>
<script type="text/javascript" src="../../script/import.js"></script>
<script type="text/javascript" src="../../script/common.js"></script>
<script type="text/javascript">
var name;
var account;
var amount;
apiready = function(){
	api.parseTapmode();
	name = api.pageParam.name;
	console.log(name)
	account = api.pageParam.account;
	console.log(account)
	amount = api.pageParam.amount;
	if(name){
		$$('#name').text(name)
	}
	if(account){
		$$('#account').text(account)
	}
	if(amount){
		var val = $$('#amount').val('余额' + amount + '元');
	}
	if(amount >= 50.00){
		$$('.comBtmBtn').removeClass('opacity')
	}else{
		$$('.comBtmBtn').addClass('opacity')
	}
	api.addEventListener({
	    name: 'guanEvent'
	}, function(ret, err){
	    if( ret ){
	         api.closeWin()
	    }else{
	         alert( JSON.stringify( err ) );
	    }
	});
settint();
};
// function onInput(){
// 	var val = $$('#amount').val();
// 	if(val >= 50){
// 		$$('.comBtmBtn').removeClass('opacity')
// 	}else{
// 		$$('.comBtmBtn').addClass('opacity')
// 	}
// }
// 提现帮助
function openHelp(){
		api.openWin({
		    name: 'ti_help_win',
		    url: 'ti_help_win.html',
		    pageParam: {
		        name: 'test'
		    }
		});
}
// 申请提现
function next(){
		if(amount >= 200.00){
		api.ajax({
		    url: BASE_URL + 'App/UserAccount/withdrawApply',
		    method: 'post',
		    data: {
		        values: {
		            userid: getUserId(),
								amount: amount
		        }
		    }
		},function(ret, err){
			// $$('#amount').val('余额' + '0' + '元');
			reLogin()
			toast(ret.msg)
		    if (ret && ret.code == 1) {
						api.openWin({
								name: 'ti_progress_win',
								url: 'ti_progress_win.html',
								pageParam: {
										val: val
								}
						});
		    } else {
		        // alert( JSON.stringify( err ) );
		    }
		});
	}
}

function settint(){
	api.ajax({
			url: BASE_URL + 'App/UserAccount/setting',
			method: 'post',
			data: {
					values: {
							name: 'haha'
					}
			}
	},function(ret, err){
			if (ret) {
				$$('#time1').text(ret.withdraw_time_1)
				$$('#time2').text(ret.withdraw_time_2)
				$$('.xiane').text(ret.withdraw_amount)
				$$('#service').text(ret.withdraw_feilv * 100)



				console.log(JSON.stringify(ret));
					// alert( JSON.stringify( ret ) );
			} else {
					// alert( JSON.stringify( err ) );
			}
	});
}
</script>
</html>
